package com.itheima.health.controller.mobile;

import com.itheima.health.common.MessageConst;
import com.itheima.health.pojo.entity.Setmeal;
import com.itheima.health.pojo.result.Result;
import com.itheima.health.service.SetMealService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController("userSetmealController")
@Slf4j
@RequestMapping("/mobile/setmeal")
public class SetmealController {

    @Autowired
    private SetMealService setMealService;

    @GetMapping("/getSetmeal")
    public Result getSetmeal(){
        List<Setmeal> setmeal = setMealService.getSetmeal();
        return new Result(true, MessageConst.ORDER_SUCCESS,setmeal);
    }

    @GetMapping("/findById")
    public Result findSById(Integer id){
        log.info("根据id查找套餐详情");
        Setmeal setmeal=setMealService.findById(id);
        return new Result(true, MessageConst.QUERY_SETMEAL_SUCCESS,setmeal);
    }
}
